<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            position: relative;
            height: 3500px; /* 设置父级元素的高度，使其填充整个视口 */
            overflow: auto; /* 添加滚动条以支持滚动 */
            width: 200px;
            background: pink;
        }

        span {
            display: inline-block;
            width: 50px;
            height: 50px;
            position: sticky;
            background: blue;
            border-radius: 30px;
        }
    </style>
</head>
<body>
    <div>
        <span>定位</span>
    </div>
</body>
</html>
